package com.zimmor.entity;

import com.zimmor.constant.ResponseCodeConstant;
import com.zimmor.constant.ResponseMessageConstant;

/**
 * @Author:zimmor
 * @Date: 2023/3/13 10:36
 * @Description 返回结果类
 * @version: 1.0.0
 */

public class ResponseResult {
    /**
     * 状态
     */
    private String status;
    /**
     * 状态码
     */
    private Integer code;
    /**
     * 返回数据
     */
    private Object data;

    public ResponseResult(String status, Integer code, Object data) {
        this.status = status;
        this.code = code;
        this.data = data;
    }

    public ResponseResult(String status, Integer code) {
        this.status = status;
        this.code = code;
        this.data = null;
    }

    public static ResponseResult success() {
        return new ResponseResult(ResponseMessageConstant.SUCCESS_MSG,ResponseCodeConstant.SUCCESS);
    }

    public static ResponseResult fail() {
        return new ResponseResult(ResponseMessageConstant.FAIL_MSG,ResponseCodeConstant.FAIL);
    }

    public static ResponseResult success(Object data) {
        return new ResponseResult(ResponseMessageConstant.SUCCESS_MSG,ResponseCodeConstant.SUCCESS, data);
    }

}
